import { createRouter, createWebHistory } from 'vue-router'
import studentManage from './modules/student.js'
import  courseManage from './modules/course.js'
import articleManage from "./modules/article.js";

const routes = [
  {
    path:'/',
    name:'home',
    component: () =>import(/* webpackChunkName: "login" */ "@/layout/Layout.vue"),
    redirect:'/profile',
    children:[
      {
        path:'/profile',
        name: 'profile',
        meta: {
          title:'个人中心',
        },
        component:()=>import(/* webpackChunkName: "profile" */ "@/views/profile/index.vue")
      }
    ]
  },
  {
    path: "/login",
    name: "login",
    component: () =>import(/* webpackChunkName: "login" */ "@/views/Login/Login.vue"),
  },
  {
    path:'/401',
    component:()=>import('@/views/error-page/401')
  },
  {
    path:'/404',
    component:()=>import('@/views/error-page/404')
  },
    studentManage,
    courseManage,
    articleManage
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
